import statement from './statement/index.js'

const parser = (tokens, filepath, type) => {
  const node = {
    type: type,
    filepath: filepath,
    filename: filepath.split('/').pop(),
    body: []
  }

  while (!tokens.eof()) {
    node.body.push(statement(tokens))
  }

  return node
}

export default parser